import { BaseEntity } from '@cool-midway/core';
import { Column, Entity } from 'typeorm';

@Entity('dr_inventory') // 可以指定表名，不指定会根据类名自己生成
export class InventoryEntity extends BaseEntity {
  @Column()
  product_code: string = null;

  @Column({
    nullable: true,
  })
  weight: string;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  buying_price: number;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  payment_amount: number;

  @Column({
    nullable: false,
  })
  box_gauge: number;

  @Column({
    nullable: false,
  })
  product_quantity: number;

  @Column({
    nullable: false,
  })
  brand_side: string;

  @Column({
    nullable: false,
  })
  supplier: string;

  @Column({
    nullable: true,
  })
  whether_to_rebate: number;

  @Column({
    nullable: false,
  })
  warehousing_time: string;

  @Column({
    nullable: false,
  })
  remaining_inventory_quantity: number;

  @Column({
    nullable: true,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  rebate_rate: number;

  @Column({
    nullable: true,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  rebate: number;

  @Column({
    nullable: true,
  })
  cost_params: string;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  cost: number;

  @Column({
    nullable: true,
  })
  source: number;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  unit_price: number;
}
